﻿using System;
using System.Collections.Generic;
using System.Text;

namespace CommandLineParser
{
    class Program
    {
        static void Main(string[] args)
        {
            if(args == null || args.Length <= 0)
            {
                args = new string[]
                {
                    "-a",
                    "apple",
                    "-b:ball",
                    "/c",
                    "cat",
                    "/d:dog",
                };
            }

            var mydata = new CommandLineParser(args).ParsedData;

            if (mydata != null)
                foreach (var pdata in mydata)
                    Print(pdata);

            Console.WriteLine("Press any key to continue...");
            Console.ReadLine();
        }

        private static void Print(CommandLineParser.CommandLineParsedData pdata)
        {
            if(pdata != null)
            {
                Console.ForegroundColor = ConsoleColor.Green;

                Console.WriteLine("Arg \"{0}\" is \"{1}\"", pdata.Key, pdata.Value == null ? "<NULL>" : pdata.Value);

                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("--------------------------------------------------------------");
                Console.WriteLine();
                Console.ResetColor();
            }
            
        }
    }

    
}
